package com.godme.concurrent.pattern;

public class ImmutablePattern {

    public static class MyThread extends Thread{
        private final int data;
        public MyThread(String name, int data){
            super(name);
            this.data = data;
        }

        @Override
        public void run() {
            int i = 0;
            while (i++ < 10){
                System.err.println(getName() + "\t:\t" + data);
            }
        }
    }

    public static void main(String[] args) {
        for (int i = 0; i < 5; i++) {
            new MyThread("thread-"+i, i).start();
        }
    }
}
